package com.ttdevs.util;

import android.content.Context;
import android.content.SharedPreferences;

public class SharePreferenceUtil implements StaticConstants {

	private SharedPreferences sp;

	public SharePreferenceUtil(Context context) {
		sp = context.getSharedPreferences(SHAREPREFERENCENAME, Context.MODE_PRIVATE);
	}

	public void putHeadSet(boolean isChecked) {
		sp.edit().putBoolean(HEADSET, isChecked).commit();
	}

	public boolean getHeadSet() {
		return sp.getBoolean(HEADSET, false);
	}

	public void putUSB(boolean isChecked) {
		sp.edit().putBoolean(USB, isChecked).commit();
	}

	public boolean getUSB() {
		return sp.getBoolean(USB, false);
	}

	public void putSMS(boolean isChecked) {
		sp.edit().putBoolean(SMS, isChecked).commit();
	}

	public boolean getSMS() {
		return sp.getBoolean(SMS, false);
	}

	public void putLight(boolean isChecked) {
		sp.edit().putBoolean(LIGHT, isChecked).commit();
	}

	public boolean getLight() {
		return sp.getBoolean(LIGHT, false);
	}

	public void putProximity(boolean isChecked) {
		sp.edit().putBoolean(PROXIMITY, isChecked).commit();
	}

	public boolean getProximity() {
		return sp.getBoolean(PROXIMITY, false);
	}

	public void putRing(boolean isRing) {
		sp.edit().putBoolean(RING, isRing).commit();
	}

	public boolean getRing() {
		return sp.getBoolean(RING, true);
	}

	public void putVibrate(boolean isVibrate) {
		sp.edit().putBoolean(VIBRATE, isVibrate).commit();
	}

	public boolean getVibrate() {
		return sp.getBoolean(VIBRATE, true);
	}

	public void putRunning(boolean isRunning) {
		sp.edit().putBoolean(RUNNING, isRunning).commit();
	}

	public boolean getRunning() {
		return sp.getBoolean(RUNNING, false);
	}

	public void putAlarmSMS(String content) {
		sp.edit().putString(ALARMSMS, content).commit();
	}

	public String getAlarmSMS() {
		return sp.getString(ALARMSMS, "110");
	}

	public void putLightSensitivity(int accuracy) {
		sp.edit().putInt(LIGHTSENSITIVITY, accuracy).commit();
	}

	public int getLightSensitivity() {
		return sp.getInt(LIGHTSENSITIVITY, 100);
	}

	public void putHeadsetPlug(boolean headset) {
		sp.edit().putBoolean(HEADSETPLUG, headset).commit();
	}

	public boolean getHeadsetPlug() {
		return sp.getBoolean(HEADSETPLUG, false);
	}
	
	public void putRingSrc(String src) {
		sp.edit().putString(RINGSRC, src).commit();
	}

	public String getRingSrc() {
		return sp.getString(RINGSRC, "content://settings/system/ringtone"); 
	}
	
	public void putRingVolume(int volume) {
		sp.edit().putInt(RINGVOLUME, volume).commit();
	}

	public int getRingVolume() {
		return sp.getInt(RINGVOLUME, 10);
	}
}
